﻿@{
    
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Header{
    @Html.ActionLink("Trang chủ", "Index", "Home", null, new Dictionary<string, object> { { "data-icon", "home" }, { "class", "ui-btn-left" } })
    <h1>@ViewBag.Title</h1>
}
@*@Html.Partial("_PartialTableListView")*@
<ul data-role="listview" data-filter="true" data-filter-placeholder="Nhập tên bàn ăn cần tìm...">
    @foreach (TableGroupModel item in ViewBag.TableGroupModels)
    { 
        <li data-role="list-divider">@item.Name</li>
        if (item != null)
        {
            foreach (TableModel subitem in item.Tables)
            {
                {
                    Html.ViewContext.Writer.Write("<li><a href='#pu" + @subitem.ID + "' data-rel='popup' data-transition='slidedown'>");
                    Html.ViewContext.Writer.Write(@subitem.Name);
                    Html.ViewContext.Writer.Write("</a></li>");
                    Html.ViewContext.Writer.Write("<div data-role='popup' class='ui-corner-all' style='min-width:210px;min-height:100px;' id='pu" + @subitem.ID + "'>");
                    Html.ViewContext.Writer.Write("<a href='#' data-rel='back' data-role='button' data-theme='a' data-icon='delete' data-iconpos='notext' class='ui-btn-right'>Close</a>");
                    Html.ViewContext.Writer.Write("<div style='padding:10px;'>");
                    Html.ViewContext.Writer.Write("<a href='/Tables/Delete/" + @subitem.ID + "' onclick='' data-role='button' data-theme='b' data-icon='delete'>Chọn món</a>");
                    Html.ViewContext.Writer.Write("<a href='/Tables/Details/" + @subitem.ID + "' id='btnEdit' data-role='button' data-theme='b' data-icon='info'>Chi tiết</a>");
                    
                    Html.ViewContext.Writer.Write("<a href='/Tables/Edit/" + @subitem.ID + "' id='btnEdit' data-role='button' data-theme='b' data-icon='edit'>Chỉnh sửa</a>");
                    Html.ViewContext.Writer.Write("<a href='/Tables/Delete/" + @subitem.ID + "' onclick='' data-role='button' data-theme='b' data-icon='delete'>Xóa</a>");
                    
                    Html.ViewContext.Writer.Write("</div>");
                    Html.ViewContext.Writer.Write("</div>");
                }
            }
        }
    }
</ul>
@section footer{
    <div data-role="navbar" data-iconpos="top">
        <ul id="mylist">
            <li>@Html.ActionLink("Thêm mới", "Create", "Tables", new { }, new Dictionary<string, object> { })</li>
            <li>@Html.ActionLink("Làm mới", "Clear", "Tables", new { }, new Dictionary<string, object> { })</li>
        </ul>
    </div>
}
